#ifndef CC_VPP_MGM_H
#define CC_VPP_MGM_H

/*** Public header file */
#include "basic_api.h"


/*** Define */
	
#define CFG_VPORT_VPTCL_MGM

#ifdef CFG_VPORT_VPTCL_MGM
#define CFG_V_PORT
#define CFG_V_PTCL		
#endif

// ctrl 通用 命令id 定义 // 
#define GCMD_STOP		1	// 无参
#define GCMD_START		2   // 无参
#define GCMD_CLEAN		3   // 无参 清楚内部缓存状态
#define GCMD_RESET		4   // 无参
#define GCMD_GET_STATE	5

// #define VPORT_ID_NULL		0x00
// #define VPTCL_ID_NULL		0x00
/*** Struct Define */

typedef struct CC_vPort_API_Set{
	int (*pWrite)(uint16_t Len,uint8_t* pPkg);	
	int (*pRead)(uint16_t RLen,uint8_t* pRBuf); 
	int (*pCtrl)(uint16_t Cmd,uint16_t Len,uint8_t* pPara); 	
} tvPortAPISet;

typedef struct CC_vPtcl_API_Set{
	int (*pRecoAndParser)(uint8_t ch);			
	int (*pBindWrite)(int (*pFunc)(uint16_t ,uint8_t* ));
    int (*pCtrl)(uint16_t Cmd,uint16_t Len,uint8_t* pPara); 
} tvPtclAPISet;

typedef struct CC_vPort_API tvPort;
typedef struct CC_vPtcl_API tvPtcl;
typedef struct CC_vPtcl_vPort_Management tvPPMgm;

//=============

/*** External Value */
extern int vPPMgm_SwitchConnect(tvPPMgm* pObj,uint16_t PtclID,uint16_t PortID);

extern tvPPMgm* vPPMgm_Create(uint16_t Id); // Id : 预留，无效，非0 即可;

//
extern void vPort_Show(tvPort* pObj);
extern void vPtcl_Show(tvPtcl* pObj);

extern tvPtcl* vPPMgm_CreatePtclAndAdd(tvPPMgm* pObj,uint16_t Id,const tvPtclAPISet* pAPI);
extern tvPort* vPPMgm_CreatePortAndAdd(tvPPMgm* pObj,uint16_t Id,const tvPortAPISet* pAPI,tMs PeriodTick,uint16_t RBufSz);
#endif

